package com.prs.crm.dao.official.impl;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import com.prs.crm.dao.impl.BaseDaoImpl;
import com.prs.crm.dao.official.DeptMailAutographDao;
import com.prs.crm.domain.official.DeptMailAutograph;

public class DeptMailAutographDaoImpl extends BaseDaoImpl<DeptMailAutograph> implements DeptMailAutographDao{

	@SuppressWarnings("unchecked")
	@Override
	public List<DeptMailAutograph> getAllDeptMailAutograph() {
		Criteria criteria=this.getSession().createCriteria(DeptMailAutograph.class);
		return criteria.list();
	}

	@Override
	public DeptMailAutograph getDeptMailAutographById(Integer id) {
		Criteria criteria=this.getSession().createCriteria(DeptMailAutograph.class)
		.add(Restrictions.eq("id", id));
		return (DeptMailAutograph) criteria.list().get(0);
	}

}
